Implement a directory source
authorAlex Crichton <alex@alexcrichton.com>
Tue, 5 Jul 2016 17:28:51 +0000 (10:28 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 1 Aug 2016 17:14:52 +0000 (10:14 -0700)
commit7fd5243c4602e25b2860d159bc50288081cbe50b
tree26c4d824256f6ce5efb19a0805768607c557de4b
parentc3a9599044ea362334d9c978ddff0b1a806b7e96
Implement a directory source

This flavor of source is intended to behave like a local registry except that
its contents are unpacked rather than zipped up in `.crate` form. Like with
local registries the only way to use this currently is via the
`.cargo/config`-based source replacement currently, and primarily only to
replace crates.io or other registries at the moment.

A directory source is simply a directory which has many `.crate` files unpacked
inside of it. The directory is not recursively traversed for changes, but rather
it is just required that all elements in the directory are themselves
directories of packages.

This format is more suitable for checking into source trees, and it still
provides guarantees around preventing modification of the original source from
the upstream copy. Each directory in the directory source is required to have a
`.cargo-checksum.json` file indicating the checksum it *would* have had if the
crate had come from the original source as well as all of the sha256 checksums
of all the files in the repo. It is intended that directory sources are
assembled from a separately shipped subcommand (e.g.  `cargo vendor` or `cargo
local-registry`), so these checksum files don't have to be managed manually.

Modification of a directory source is not the intended purpose, and if a
modification is detected then the user is nudged towards solutions like
`[replace]` which are intended for overriding other sources and processing local
modifications.
12 files changed:
src/cargo/core/source.rs
src/cargo/ops/cargo_rustc/fingerprint.rs
src/cargo/sources/config.rs
src/cargo/sources/directory.rs [new file with mode: 0644]
src/cargo/sources/mod.rs
src/cargo/sources/replaced.rs
tests/cargotest/support/registry.rs
tests/cfg.rs
tests/directory.rs [new file with mode: 0644]
tests/install.rs
tests/local-registry.rs
tests/publish.rs